#include "changeSize.h"

#include "GLTools.h"
#include "GLFrustum.h"
#include "GLMatrixStack.h"
#include "GLGeometryTransform.h"

GLFrustum viewFrustum; // View Frustum
GLMatrixStack projectionMatrix; // Projection Matrix
GLGeometryTransform	transformPipeline; // Geometry Transform Pipeline
GLMatrixStack modelViewMatrix; // Modelview Matrix

///////////////////////////////////////////////////
// Screen changes size or is initialized
void changeSize(int nWidth, int nHeight) {
	glViewport(0, 0, nWidth, nHeight);

	// Create the projection matrix, and load it on the projection matrix stack
	viewFrustum.SetPerspective(35.0f, float(nWidth)/float(nHeight), 1.0f, 100.0f);
	projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix());

	// Set the transformation pipeline to use the two matrix stacks 
	transformPipeline.SetMatrixStacks(modelViewMatrix, projectionMatrix);
}
